﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GroupList.aspx.cs" Inherits="SysManage.Module.Grassroots.GroupList" %>



<!DOCTYPE html>
<html>
<head runat="server">
    <title></title>
    <style type="text/css">
       
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <f:PageManager ID="PageManager1" AutoSizePanelID="RegionPanel1" runat="server"></f:PageManager>
        <f:RegionPanel ID="RegionPanel1" ShowBorder="false" runat="server">
            <Regions>
                <f:Region ID="Region1" ShowBorder="false" ShowHeader="false" Width="400px" Position="Left" Layout="Fit" BodyPadding="5px" runat="server">
                    <Items>
                        <f:Grid ID="Grid1" runat="server" ShowBorder="true" ShowHeader="false" EnableCheckBoxSelect="false" DataKeyNames="ID"
                            AllowSorting="false" OnSort="Grid1_Sort" SortField="CreateTime" SortDirection=""
                            AllowPaging="false" EnableMultiSelect="false" OnRowCommand="Grid1_RowCommand" OnRowClick="Grid1_RowClick" EnableRowClickEvent="true">
                            <Columns>
                                <f:RowNumberField></f:RowNumberField>
                                <f:BoundField DataField="GroupName" SortField="GroupName" ExpandUnusedSpace="true" HeaderText="分组名称"></f:BoundField> 
                                <f:BoundField DataField="StateName" SortField="StateName" Width="60px" HeaderText="状态" TextAlign="Center"></f:BoundField>
                                <f:BoundField DataField="OrderNo" SortField="OrderNo" Width="50px" HeaderText="序号" TextAlign="Center"></f:BoundField>
                                <f:WindowField ColumnID="editField4" TextAlign="Center" Text="管区"   ToolTip="管区" WindowID="WindowType"
                                    Title="管区" DataIFrameUrlFields="ID" HeaderText="管区"
                                    DataIFrameUrlFormatString="ItemTyptList.aspx?GroupID={0}"
                                    Width="50px" />
                                 
                                 <f:WindowField ColumnID="editField" TextAlign="Center" Icon="Pencil" 
                                     ToolTip="编辑" WindowID="WindowModule"
                                    Title="编辑" DataIFrameUrlFields="ID" HeaderText="编辑"
                                    DataIFrameUrlFormatString="GroupEdit.aspx?id={0}"
                                    Width="50px" />
                                <f:LinkButtonField ColumnID="deleteField" TextAlign="Center" Icon="Delete"
                                    ToolTip="删除" ConfirmText="确定删除此数据？"  HeaderText="删除"
                                    ConfirmTarget="Top"  CommandName="Delete" Width="50px">
                                </f:LinkButtonField>
                            </Columns>
                            <Toolbars>
                                <f:Toolbar runat="server" ID="module1">
                                    <Items>
                                        <f:ToolbarFill ID="ToolbarFill2" runat="server">
                                        </f:ToolbarFill>
                                        <f:Button ID="btnModule" runat="server" Icon="Add" EnablePostBack="false" Text="新增分组">
                                        </f:Button>
                                    </Items>
                                </f:Toolbar>


                            </Toolbars>
                        </f:Grid>
                    </Items>
                </f:Region>
                <f:Region ID="Region2" ShowBorder="false" ShowHeader="false" Position="Center" Layout="VBox" BoxConfigAlign="Stretch" BoxConfigPosition="Left" BodyPadding="5px 5px 5px 0" runat="server">
                    <Items>
                        
                         <f:Form ID="Form2" runat="server" Height="36px" BodyPadding="5px" ShowHeader="false"
                    ShowBorder="false">
                    <Rows>
                        <f:FormRow ID="FormRow1" runat="server">
                            <Items>
                                <f:Panel ID="Panel2" ShowHeader="false" CssClass="formitem" ShowBorder="false"
                                    Layout="HBox" runat="server">
                                    <Items>
                                        <f:TextBox BoxFlex="1" ID="txtTitle" runat="server" Label="小组名称"
                                              EmptyText="请输入小组名称" LabelAlign="right" LabelWidth="80px"></f:TextBox>
                               
                                        <f:Button Margin="0 0 0 5" ID="btnSearch" runat="server" Text="搜索" OnClick="btnSearch_Click" Icon="SystemSearch"></f:Button>
                                    <f:Label runat="server" BoxFlex="1"></f:Label>
                                    </Items>
                                </f:Panel>
                            </Items>
                        </f:FormRow>
                    </Rows>
                </f:Form>
                        <f:Grid ID="Grid2" runat="server" BoxFlex="1" ShowBorder="true" ShowHeader="false" EnableCheckBoxSelect="true"
                            DataKeyNames="ID" AllowSorting="false"
                            SortField="OrderNo"
                            AllowPaging="true"
                            IsDatabasePaging="true" OnPreDataBound="Grid2_PreDataBound" OnRowCommand="Grid2_RowCommand" OnPageIndexChange="Grid2_PageIndexChange">
                            <Toolbars>
                                <f:Toolbar ID="Toolbar1" runat="server">
                                    <Items>
                                        <f:Button ID="btnDeleteSelected" Icon="Delete" runat="server" ConfirmText="确认要删除选中数据？" Text="删除选中数据" OnClick="btnDeleteSelected_Click">
                                        </f:Button>
                                        <f:ToolbarSeparator runat="server">
                                        </f:ToolbarSeparator>
                                        <f:Button ID="btnChangeEnableUsers" Icon="GroupEdit" EnablePostBack="false" runat="server"
                                            Text="设置发布状态">
                                            <Menu runat="server">
                                                <f:MenuButton ID="btnEnableUsers" OnClick="btnEnable_Click" runat="server" Text="发布选中数据">
                                                </f:MenuButton>
                                                <f:MenuButton ID="btnDisableUsers" OnClick="btnDisable_Click" runat="server"
                                                    Text="禁用选中数据">
                                                </f:MenuButton>
                                            </Menu>
                                        </f:Button>

                                        <f:ToolbarFill ID="ToolbarFill1" runat="server">
                                        </f:ToolbarFill>
                                        <f:Button ID="btnNew" runat="server" Icon="Add" EnablePostBack="false" Text="新增小组">
                                        </f:Button>
                                    </Items>
                                </f:Toolbar>
                            </Toolbars>
                            <PageItems>
                                <f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
                                </f:ToolbarSeparator>
                                <f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数：">
                                </f:ToolbarText>
                                <f:DropDownList ID="ddlGridPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlGridPageSize_SelectedIndexChanged" runat="server">
                                    <f:ListItem Text="10" Value="10"></f:ListItem>
                                    <f:ListItem Text="20" Value="20"></f:ListItem>
                                    <f:ListItem Text="50" Value="50"></f:ListItem>
                                    <f:ListItem Text="100" Value="100"></f:ListItem>
                                </f:DropDownList>
                            </PageItems>
                            <Columns>
                                <f:RowNumberField></f:RowNumberField>
                                <f:BoundField DataField="ItemName" ExpandUnusedSpace="true" HeaderText="小组名称"></f:BoundField>
                                <f:BoundField DataField="LinkMan" HeaderText="联系人" Width="90px" TextAlign="Center"></f:BoundField>
                                <f:BoundField DataField="StateName" HeaderText="状态" Width="60px" TextAlign="Center"></f:BoundField>
                                <f:BoundField DataField="OrderNo" HeaderText="序号" Width="60px" TextAlign="Center"></f:BoundField>
                               <f:WindowField ColumnID="editField3" TextAlign="Center" Icon="Group"  ToolTip="小组成员" WindowID="WindowMembers"
                                    Title="小组成员" DataIFrameUrlFields="ID" HeaderText="小组成员"
                                    DataIFrameUrlFormatString="ItemMemberList.aspx?ItemID={0}"
                                    Width="80px" />
                               
                               
                                <f:WindowField ColumnID="editField2" TextAlign="Center" Icon="Pencil"  ToolTip="编辑" WindowID="Window1"
                                    Title="编辑" DataIFrameUrlFields="ID,GroupID" HeaderText="编辑"
                                    DataIFrameUrlFormatString="ItemEdit.aspx?id={0}&GroupID={1}"
                                    Width="50px" />  
                                <f:LinkButtonField ColumnID="deleteField2" TextAlign="Center" Icon="Delete" HeaderText="删除"
                                    ToolTip="删除" ConfirmText="确定删除此数据？" ConfirmTarget="Top" CommandName="Delete" Width="50px">
                                </f:LinkButtonField>
                            </Columns>
                        </f:Grid>
                    </Items>
                </f:Region>
            </Regions>
        </f:RegionPanel>
        <f:Window ID="Window1" CloseAction="Hide" runat="server" IsModal="true" Hidden="true"
             Target="Top" EnableResize="true" EnableMaximize="true" EnableIFrame="true" 
            IFrameUrl="about:blank" Width="750px" Height="400px" OnClose="Window1_Close">
        </f:Window>
        <f:Window ID="WindowModule" CloseAction="Hide" runat="server" IsModal="true" 
            Hidden="true" Target="Top" EnableResize="true" EnableMaximize="true"
             EnableIFrame="true" IFrameUrl="about:blank" Width="500px" Height="220px" OnClose="Window2_Close">
        </f:Window>
         <f:Window ID="WindowMembers" CloseAction="Hide" runat="server" IsModal="true" Hidden="true"
             Target="Top" EnableResize="true" EnableMaximize="true" EnableIFrame="true" 
            IFrameUrl="about:blank" Width="850px" Height="500px" OnClose="Window1_Close">
        </f:Window>
        <f:Window ID="WindowType" CloseAction="Hide" runat="server" IsModal="true" Hidden="true"
             Target="Top" EnableResize="true" EnableMaximize="true" EnableIFrame="true" 
            IFrameUrl="about:blank" Width="650px" Height="400px" OnClose="Window1_Close">
        </f:Window>
            <f:HiddenField ID="hdModule" runat="server">
        </f:HiddenField>

        <f:HiddenField ID="hdSelectrowindex" runat="server">
        </f:HiddenField>
    </form>
</body>
</html>
<script src=".././../../../Scripts/jquery.min.js"></script>
<script type="text/javascript">
    var SelectrowindexClientID = '<%= hdSelectrowindex.ClientID %>';

    var gridClientID = '<%= Grid1.ClientID %>';

    function SelectRow() {
        // 增加延迟，等待HiddenField更新完毕
        window.setTimeout(function () {
            var selectFirstRow = F(SelectrowindexClientID);
           
            $("#" + gridClientID).find('tr[role="row"]').eq(selectFirstRow.getValue()).addClass('x-grid-row-selected');

        }, 200);
    }

    // 页面第一个加载完毕后执行的函数
    F.ready(function () {
        SelectRow();

    });
    function addSelectCss(index) {
        $("#" + gridClientID).find('tr[role="row"]').removeClass('x-grid-row-selected');
        $("#" + gridClientID).find('tr[role="row"]').eq(index).addClass('x-grid-row-selected');
    }
</script>

